package com.jcli.jb51_net.article._获取屏幕任务栏宽度;

import java.awt.*;

public class TaskbarDimensions {
    public static void main(String[] args) {
        //获取整个屏幕的尺寸
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        //获取屏幕上的最大窗口边界（不包括任务栏
        Rectangle maxBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();

        int taskbarWidth = (int) (screenSize.getWidth() - maxBounds.getWidth());
        int taskbarHeight = (int) (screenSize.getHeight() - maxBounds.getHeight());

        System.out.println("任务栏宽度：" + taskbarWidth + "px");
        System.out.println("任务栏高度：" + taskbarHeight + "px");
    }
}
